﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace PapnKukn.Silverlight.SilverKnight
{
    public class Logger
    {
        public static void LogException(Exception ex)
        {
            //TODO: Call service asynchronously and insert a record in bug tracker system
        }

        public static void ShowException(Exception ex)
        {
            try
            {
                string errorMsg = ex.Message + ex.StackTrace;
                errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
                System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight 2 Application " + errorMsg + "\");");
            }
            catch
            {
            }
        }
    }
}
